<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="送货对账单" />
<%@ include file="../inc/PrintTitle.jsp"%>
<head>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doPrint(){
		ShowConfirm('确认框','确定开始打印吗？',340,80,"doPrintExt()");
	}
	function doPrintExt(){
		if(popRetVal!=null){
			document.getElementById("noPrinSpan").style.display="none";
			printContent("管理易-送货对账单","${enterpriseInfo.doPrint}","${enterpriseInfo.printWidth}");
			document.getElementById("noPrinSpan").style.display="";
		}
	}
	function doCancel(){
		window.close();
	}
	function doDownload(type){
		var str=getSearchCondiction();
		window.location='/business/DeliverBillListForAccount.ihtm?content_type='+type+'&'+str;
	}
	function getSearchCondiction(){
		var clientId="${client_id}";
		var startDate="${start_date}";
		var endDate="${end_date}";
		var linkman="${linkman}";
		var includeSub="${include_sub}";
		var orderBy="${order_by}";
		return 'client_id='+clientId+'&start_date='+startDate+'&end_date='+endDate+'&linkman='+encodeURIComponent(linkman)+'&include_sub='+includeSub+'&order_by='+orderBy;
	}
	function doRefresh(){
		var str=getSearchCondiction();
		window.location='/business/DeliverBillListForAccount.ihtm?'+str;
	}
</script>
</head>
<c:remove var="alertMsg" scope="session" /><!-- 不显示信息 -->
<body style="background-color:#FFFFFF" onLoad="doPrintCallBack();">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td width="16%"><img src="${enterpriseInfo.loginImage}" /></td>
					<td width="68%" height="40px" align="center" class="FontLarge_Bold">${licenseInfo.enterpriseName} 送货对账单</td>
					<td width="16%">&nbsp;</td>
				</tr>
		  </table>
		</td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="ListTable">
				<tr class="ListTrPrint">
			      	<td class="FontSmall"  width="35%">订货单位：${est.estName}<c:if test="${include_sub=='1'}">(包括下属单位)</c:if></td>
			      	<td class="FontSmall"  width="40%">日期：${start_date} 至 ${end_date}</td>
					<td class="FontSmall" width="25%" >送货金额：${costTotal}</td>
				</tr>
				<tr class="ListTrPrint">
			      	<td class="FontSmall">地址：${est.address}</td>
					<td class="FontSmall">联系人：${contact.contactName}</td>
			      	<td class="FontSmall">电话：<c:if test="${contact.phone!=null && contact.phone!=''}">${contact.phone}&nbsp;</c:if><c:if test="${contact.mobile!=null && contact.mobile!=''}">${contact.mobile}</c:if></td>		      	
				</tr>
		  </table>			
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="small_border">
				<tr class="ListTrPrint">
                    <td width="3%" class="FontSmall_Bold"> <div align="center">序号</div></td>
					<td width="8%" class="FontSmall_Bold"><div align="center">日期</div></td>
					<td width="8%" class="FontSmall_Bold"><div align="center">单号</div></td>
					<td width="7%" class="FontSmall_Bold"><div align="center">项目类型</div></td>
					<td width="9%" class="FontSmall_Bold"><div align="center">内容</div></td>
					<td width="10%" class="FontSmall_Bold"><div align="center">材质</div></td>
					<td width="14%" class="FontSmall_Bold"><div align="center">规格</div></td>
					<td width="5%" class="FontSmall_Bold"><div align="center">单位</div></td>
					<td width="5%" class="FontSmall_Bold"><div align="center">数量</div></td>
					<td width="6%" class="FontSmall_Bold"><div align="center">单价</div></td>
					<td width="7%" class="FontSmall_Bold"><div align="center">金额</div></td>
					<td width="10%" class="FontSmall_Bold"><div align="center">制作要求</div></td>
					<td  width="8%" class="FontSmall_Bold"><div align="center"><c:if test="${include_sub=='1'}">部门/</c:if>经手人</div></td>
				</tr>
				<c:set var="preBillId" value="0" />
				<c:forEach var="item" items="${qr.list}" varStatus="i">
				<tr class="ListTrPrint">
					<td class="FontSmall" align="center">${i.index+1}</td>
					<td class="FontSmall" align="center">
						<c:if test="${preBillId!=item[7]}"><fmt:formatDate value="${item[3]}" pattern="yyyy-MM-dd"/></c:if>
					</td>
					<td class="FontSmall" align="center">
						<c:if test="${preBillId!=item[7]}">${item[2]}</c:if>
					</td>
					<td class="FontSmall" align="center"><commonTag:showSimpleObjectName list="${mtList}" objectId="${item[0].makeTypeId}" /></td>
					<td class="FontSmall" align="center"><commonTag:parseEnterToBr source="${item[0].finishedContent}" /></td>
					<td class="FontSmall" align="center">${item[0].proName}</td>
					<td class="FontSmall" align="center">
						<commonTag:parseEnterToBr source="${item[0].specification}" />
						<c:if test="${item[0].priceType=='AREA' || item[0].priceType=='LENGTH'}"> x <commonTag:parseBigDecimal source="${item[0].amount}" /></c:if>
					</td>
					<td class="FontSmall" align="center">
						<c:if test="${item[0].priceType=='AREA'}">平方米</c:if>
						<c:if test="${item[0].priceType=='LENGTH'}">
							<c:if test="${item[0].lengType=='M'}">米</c:if><c:if test="${item[0].lengType=='CM'}">公分</c:if>
						</c:if>
						<c:if test="${item[0].priceType=='AMOUNT'}">${item[0].unit}</c:if>
					</td>
					<td class="FontSmall"><div align="right"><commonTag:parseBigDecimal source="${item[4]}" /></div></td>
					<td class="FontSmall"><div align="right"><commonTag:parseBigDecimal source="${item[0].unitPrice}" /></div></td>
					<td class="FontSmall"><div align="right"><commonTag:parseBigDecimal source="${item[5]}" /></div></td>
					<td class="FontSmall"><div align="center"><commonTag:parseEnterToBr source="${item[0].makeRequire}" /></div></td>
					<td class="FontSmall" align="center">
                        <c:if test="${preBillId!=item[7]}">
                        	<c:if test="${include_sub=='1' && est.estName!=item[1]}">${item[1]}</c:if>
                        	${item[6]}
                        </c:if>
					</td>
				</tr>
				<c:if test="${preBillId!=item[7]}"><c:set var="preBillId" value="${item[7]}" /></c:if>
				</c:forEach>
			</table>
			
		</td>
	</tr>
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="ListTable">
				<tr class="ListTrPrint">
			      	<td class="FontSmall" align="right" width="86%">客户确认：</td>
					<td class="FontSmall" width="14%">&nbsp;</td>
				</tr>
		  </table>
		</td>
	</tr>
	<c:if test="${codeRule.printFoot!=null && codeRule.printFoot!=''}">
	<tr>
		<td height="3"></td>
	</tr>
	<tr>
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td class="FontSmall"><commonTag:parseEnterToBr source="${codeRule.printFoot}" /></td>
				</tr>
			</table>
		</td>
	</tr>
	</c:if>
	<tr id="noPrinSpan">
		<td>
			<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center">
				<tr>
					<td>
						<input type="button" id="printButton" class="Button" value="开始打印" onClick="doPrint();">
						<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_EXPO;')==-1}">
							<input type="button" id="printButton" class="Button" value="导出 " onClick="doDownload('EXCEL');">
						</c:if>
						<input type="button" id="refreshButton" class="Button" value=" 刷新 " onClick="doRefresh();">
						<input type="button" id="cancelButton" class="Button" value=" 退 出 " onClick="doCancel();">
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>
